﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using IMPression;

namespace IMPressive
{
    /// <summary>
    /// Logique d'interaction pour About.xaml
    /// </summary>
    public partial class About : Window
    {
        public About()
        {
            InitializeComponent();
            lblLst.ToolTip = new TextBlock() {Text = new EquationParser().CleanUp(string.Join(", ", Funcs))};
            lblConst.ToolTip = new TextBlock() { Text = "π (pi) ≈ 3.14159265\ne ≈ " + Math.Round(Math.E, 8) + "\nφ (phi) ≈ " + Math.Round(IMPression.Constant.Phi, 8) + "\nγ (euler gamma) ≈ " + Math.Round(IMPression.Constant.EulerGamma, 8) + "\ncatalan (constante de catalan) ≈ " + Math.Round(IMPression.Constant.Catalan, 8) + "\nc ≈ 299792458 m/s" };
        }

        public List<string> Funcs
        {
            get
            {
                var st = new List<string>() {};
                Function.FunctionsList.All(x =>
                {
                    st.Add(x.Contains('(') ? x.Substring(0, x.IndexOf('(')) : x);
                    return true;
                });
                st.RemoveRange(0, 6);
                st = st.OrderBy(x => x).Distinct().ToList();
                return st;
            }
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
